package com.westcom.healthmate.common.network.http;

import java.io.IOException;

import com.westcom.healthmate.common.utils.CommonUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.DefaultHttpClient;

public class SyncPut 
{
	private DefaultHttpClient mHttpClient;
	
    public static SyncPut create() {
        return new SyncPut();
    }
    
    public SyncPut() {
	    mHttpClient = new DefaultHttpClient();
    }
    public HttpResponse put(String url,org.apache.http.Header[] h,HttpEntity entity) throws ClientProtocolException, IOException
    {
    	HttpPut httpput = new HttpPut(url);
    	if(null != h)
    	{
    		httpput.setHeaders(h);
    	}
    	if(null != entity)
    	{
    		httpput.setEntity(entity);
    	}
		CommonUtils.disableSSLVerification(mHttpClient);
        HttpResponse httpResponse = mHttpClient.execute(httpput);
        return httpResponse;
    }
}
